package com.lin.springcloud.controller;

import com.lin.springcloud.pojo.Dept;
import com.lin.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @ author:lin tingfeng
 * @ data:2021/10/9-17:32
 */
@RestController
public class DeptConsumerController {

    @Autowired
    private DeptService deptService;

    @GetMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return deptService.queryDeptById(id);
    }

    @PostMapping("/consumer/dept/add")
    public boolean add(Dept dept) {
        return deptService.addDept(dept);
    }

    @GetMapping("/consumer/dept/list")
    public List<Dept> list() {
        return deptService.queryDeptAll();
    }
}
